package cn.kgc.dao;

import cn.kgc.pojo.User;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

public class UserDaoImpl extends BaseDao implements UserDao {
    @Override
    public User getUserByName(Connection conn,String name) throws SQLException {
        String sql="select id,userName,password,email,userType from news_user where userName =?";
        ResultSet rs= execuseQuery(conn,sql,name);
        User user=null;
        while(rs.next()){
             int id =rs.getInt(1);
             String userName=rs.getString(2);
             String password=rs.getString(3);
             String email=rs.getString(4);
             int userType=rs.getInt(5);
            user = new User(id,userName,password,email,userType);
        }
        return user;
    }
}
